<template>
  <RouterView v-slot="{ Component, route }">
    <keep-alive v-if="route.meta.keepAlive">
      <component :is="Component"></component>
    </keep-alive>
    <component v-else :is="Component"></component>
  </RouterView>
  <Tabbar v-if="isShowTabbar" />
</template>
<script setup>
import { onMounted, defineComponent, computed } from 'vue'
import Tabbar from '@/components/common/Tabbar.vue'
import { useAppStore, useUserStore } from '@/stores'
import { storeToRefs } from 'pinia'
const appVC = defineComponent({
  name: 'App',
  // 组件的其他选项...
})
const gStore = useAppStore()
const userStore = useUserStore()
const { tabbarStatus } = storeToRefs(gStore)

const isShowTabbar = computed(() => {
  return tabbarStatus.value
})

onMounted(() => {
  if (!isShowTabbar) {
    gStore.setTabbarStatus(true)
  }
  userStore.initUser()
})
</script>

<style scoped>
body {
  background-color: #f1f1f1;
}
</style>
